package com.gency.subscribe.web.controller.system;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.baomidou.mybatisplus.plugins.Page;
import com.gency.subscribe.model.system.OrderBase;
import com.gency.subscribe.model.system.PageBean;
import com.gency.subscribe.service.system.IOrderBaseService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 马行空
 * @since 2018-06-26
 */
@Controller
@RequestMapping("/orderBase")
public class OrderBaseController {

	@Autowired
	IOrderBaseService orderBaseService;
	
	
	@GetMapping("/list")
	public ModelAndView list(PageBean pb,ModelAndView mv){
		Page<OrderBase> page = new Page<OrderBase>(pb.getCurPage(),pb.getPageSize());
		List<OrderBase> list = orderBaseService.orderList(page);
		pb.setAllRow(page.getTotal());
		pb.setCurPage(page.getCurrent());
		pb.setTotalPage(page.getPages());
		pb.setNextPage(page.getOffset());
		pb.setBeforPage(page.getOffsetCurrent());
		pb.setPageSize(10);
		pb.setStartRow(1);
		mv.addObject("pagebean",pb);
		mv.addObject("orderlist", list);
		mv.setViewName("order/list");
		return mv;
	}
}

